export function formatDate(last_time) {
    const px_d = 1000 * 60 * 60 * 24;
    const px_h = 1000 * 60 * 60;
    const px_m = 1000 * 60;
    const px_s = 1000;
    let d = Math.floor(last_time / px_d);
    if (0 < d && d < 10) {
        d = "0" + d;
    }
    let h = Math.floor((last_time - d * px_d) / px_h);
    if (0 < h && h < 10) {
        h = "0" + h;
    }
    let m = Math.floor((last_time - d * px_d - h * px_h) / px_m);
    if (0 < m && m < 10) {
        m = "0" + m;
    }
    let s = Math.floor((last_time - d * px_d - h * px_h - m * px_m) / px_s);
    if (0 < s && s < 10) {
        s = "0" + s;
    }
    if (d < 0 || h < 0 || m < 0 || s < 0) {
        const returnDate = {
            days: 0,
            hours: 0,
            minutes: 0,
            seconds: 0
        }
        return returnDate;
    } else {
        const returnDate = {
            days: d,
            hours: h,
            minutes: m,
            seconds: s
        }
        return returnDate;

    }
    // return d + " days " + h + " hours " + m + " minutes "
    // + s + " seconds ";
};